package com.oauth.resources.utils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.sun.org.apache.regexp.internal.RE;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * @author 林思浩
 * @date 2020/12/22 17:37
 */
@Data
public class Result implements Serializable {

    private Integer code;

    private String message;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Object data = new ArrayList<>();

    public Result() {}

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Result ok() {
        return new Result(200, "请求成功");
    }

    public static Result fail() {
        return new Result(202, "请求失败");
    }

}
